﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace blog.Model.Vo
{
    public class AjaxResult
    {

        public int code { get; set; } = 0;

        public string msg { get; set; } = string.Empty;

        public long count { get; set; } = 0;

        public dynamic data { get; set; } = new List<dynamic>();

        public static AjaxResult Success(dynamic data = null, long count = 0)
        {
            AjaxResult result = new AjaxResult()
            {
                code = 200,
                msg = "操作成功",
                data = data,
                count = count
            };
            return result;
        }

        public static AjaxResult Error(string msg = "操作失败")
        {
            AjaxResult result = new AjaxResult()
            {
                code = 500,
                msg = msg
            };
            return result;
        }


    }
}
